home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 2010 April
/
PCWorld0410.iso
/
pluginy Firefox
/
2325
/
2325.xpi
/
chrome
/
content
/
bookmark-observer.js
< prev
next >
Wrap
Text File
|
2009-11-24
|
2KB
|
54 lines
var tickerBookmarkObserver = {
onBeginUpdateBatch: function() {
// This method is notified when a batch of changes are about to occur.
// Observers can use this to suspend updates to the user-interface, for example
// while a batch change is occurring.
},
onEndUpdateBatch: function() {
this._inBatch = false;
},
onItemAdded: function(id, folder, index) {
// Handled by onItemChanged
},
onItemRemoved: function(id, folder, index) {
// Determine if it's a livemark.
// If it is, remove it from the tree.
RSSTICKER.removeFeed(id);
},
onItemChanged: function(id, property, isAnnotationProperty, value) {
// isAnnotationProperty is a boolean value that is true of the changed property is an annotation.
// You can access a bookmark item's annotations with the <code>nsIAnnotationService</code>.
if (property == "livemark/feedURI") {
RSSTICKER.removeFeed(id);
RSSTICKER.updateSingleFeed(id);
}
},
onItemVisited: function(id, visitID, time) {
// The visit id can be used with the History service to access other properties of the visit.
// The time is the time at which the visit occurred, in microseconds.
},
onItemMoved: function(id, oldParent, oldIndex, newParent, newIndex) {
// oldParent and newParent are the ids of the old and new parent folders of the moved item.
},
QueryInterface: function(iid) {
if (iid.equals(Ci.nsINavBookmarkObserver) ||
iid.equals(Ci.nsISupports)) {
return this;
}
throw Cr.NS_ERROR_NO_INTERFACE;
},
};
var bmsvc = Components.classes["@mozilla.org/browser/nav-bookmarks-service;1"].
getService(Components.interfaces.nsINavBookmarksService);
bmsvc.addObserver(tickerBookmarkObserver, false);
window.addEventListener("unload", function () { bmsvc.removeObserver(tickerBookmarkObserver); }, false);